/*
 * @brief
 * @file robot.c
 *
 * @author Robert Breznak
 */

#include "modules/device.h"
#include "modules/adc.h"
#include "dispatcher.h"
#include "robot.h"
#include "communicator.h"

#include <avr/interrupt.h>

void init_robot(void) {
	register_action(ROBOT, START_ROBOT, &start_robot);
	register_action(ROBOT, HALT_ROBOT, &halt_robot);
}

void init_modules(void) {
	init_adc();
	register_action(ANALOG_DIGITAL_CONVERTER, REQUEST_VALUE, &send_adc_value);
}

void start_robot(uint8_t id, uint8_t *data, uint8_t length) {
	init_modules();
}

void halt_robot(uint8_t id, uint8_t *data, uint8_t length) {
	cli();
	while (1) {

	}
}

